import { updateDynamicFormConfig } from '@/api/form'

export default {
  name: 'form',
  props: {
    formConfig: {
      default: () => {
        return {}
      },
      type: Object
    }
  },
  methods: {
    realtimeUpdateForm(form) {
      updateDynamicFormConfig(form).then(() => {
        this.$message({
          type: 'success',
          message: '保存表单成功'
        })
      })
    },
    dynamicOnlineSave() {
      this.realtimeUpdateForm(this.formConfig)
    }
  }
}
